The invention relates generally to a method for improving the quality of a digital image. In particular, the invention relates to a method using an adaptive variable threshold to sharpen digital color images.
Digital cameras, scanners, copiers and facsimile machines provide images in digital format for subsequent processing and transmission. Often the digital images include noise which results in blurring of the image after filtering. Interpolation of digital images, used to transform a digital image to a desired image size, can also result in blurring of the processed image. Image enhancement techniques are often implemented to improve the image quality by sharpening features in the image. Some image enhancement methods use digital filtering to emphasize, or sharpen, the edges in a digital image. Artifacts, such as ringing, are sometimes apparent in the filtered image, especially for filtering methods which provide greater edge transitions in the processed image. Color images are sometimes sharpened by independently processing the three red-green-blue (RGB) color planes. Unfortunately, this can result in significant color shifts since the high frequency information in one color plane is not necessarily present in the other color planes.
The present invention relates to adaptive spatial filtering of digital images. The invention overcomes the ringing and color shift problems resulting from use of common image sharpening methods. In one aspect, the invention relates to a method of adaptive spatial filtering for a digital image. The method includes the steps of receiving an array of source pixels and applying a window to the array of source pixels to generate an array of windowed pixels centered on a source pixel. Upper and lower threshold values are determined from the array of windowed pixels. In one embodiment, the upper threshold value and the lower threshold value are determined from the maximum and minimum values in the array of windowed pixels. A spatial frequency filter is applied to the array of windowed pixels to generate a filtered array that includes a reference pixel. The spatial frequency filter can be a low pass filter or a high pass filter. The values of the source pixel and the reference pixel are combined to create an enhanced value. The enhanced value is replaced with the lower threshold value if the enhanced value is less than the lower threshold value. Conversely, the enhanced value is replaced with the upper threshold value if the enhanced value is greater than the upper threshold value.
In one embodiment, the dimensions of the window represent a square. In another embodiment, an array of pixels in one color space are converted to an array of source pixels in a different color space. In another embodiment, the method includes the additional step of applying a first weighting factor to the value of the source pixel and applying a second weighting factor to the value of the reference pixel prior to combining their values.
In another aspect, the invention relates to a system for enhancing a digital image. The system includes a window module, a threshold module and a filter module. The window module provides an array of windowed pixels centered on a source pixel to the threshold module and a filter module. The threshold module determines an upper and a lower threshold and the filter module provides a filtered array of pixels, including a reference pixel. An adder provides an enhanced value that is substantially equal to the combined values of the source pixel and the reference pixel. A comparator module receives the upper and lower thresholds from the threshold module, and the enhanced value from the adder. The comparator provides the value of the reference pixel if the value of the reference pixel does not exceed the upper threshold value and is not less than the lower threshold value. If the value of the reference pixel exceeds the upper threshold value, the comparator provides the upper threshold value. If the value of the reference pixel is less than the lower threshold value, the comparator provides the lower threshold value.